import { paneSize } from './type.ts'
//处理 xp 和 %
const formatSize = (value: string): paneSize => {
  let size: paneSize = { value: 0, unit: '%' }
  if (value.toLowerCase().indexOf('px') != -1) {
    size.value = parseFloat(value.split('px')[0])
    size.unit = 'px'
  } else if (value.toLowerCase().indexOf('%') != -1) {
    size.value = parseFloat(value.split('%')[0])
    size.unit = '%'
  }
  return size
}

export { formatSize }
